package com.itheima.controller;


import com.itheima.pojo.Order;
import com.itheima.pojo.Result;
import com.itheima.pojo.Setmeal;
import com.itheima.service.impl.OrderServiceImpl;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Log4j2
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderServiceImpl orderServiceImpl;

    @GetMapping("/page")
    public Result getAll(String beginTime,String endTime,Integer number,
                         @RequestParam Integer page,
                         @RequestParam Integer pageSize){
        return orderServiceImpl.getAll(beginTime,endTime,number,page,pageSize);
    }


    /**
     * 修改订单状态
     * @param status
     * @param id
     * @return
     */
    @PutMapping
    public Result update(Integer status,String id){
        return orderServiceImpl.update(status,id);
    }
}
